# -*- coding:utf-8 -*-
#1新增 2修改 3删除 4授权 5导出 6导入 7强退 8生成代码 9清空数据 10其它 11：登录 12：退出
class BusinessType:
    INSERT = 1
    UPDATE = 2
    DELETE = 3
    GRANT = 4
    EXPORT = 5
    IMPORT = 6
    KICKOUT = 7
    GENCODE = 8
    CLEAR = 9
    OTHER = 10
    LOGIN = 11
    LOGOUT = 12



class CacheConstants:
    """
    缓存常量信息
    """
    # 缓存有效期，默认720（分钟）
    EXPIRATION = 720
    # 缓存刷新时间，默认120（分钟）
    REFRESH_TIME = 120
    # 密码最大错误次数
    PASSWORD_MAX_RETRY_COUNT = 5
    # 密码锁定时间，默认10（分钟）
    PASSWORD_LOCK_TIME = 10
    # 权限缓存前缀
    LOGIN_TOKEN_KEY = "access_tokens:"
    # 验证码 redis key
    CAPTCHA_CODE_KEY = "captcha_codes:"
    # 参数管理 cache key
    SYS_CONFIG_KEY = "sys_config:"
    # 字典管理 cache key
    SYS_DICT_KEY = "sys_dict:"
    # 登录账户密码错误次数 redis key
    PWD_ERR_CNT_KEY = "pwd_err_cnt:"
    # 登录IP黑名单 cache key
    SYS_LOGIN_BLACK_IP_LIST = SYS_CONFIG_KEY + "sys.login.blackIPList"
    # 令牌前缀
    LOGIN_USER_KEY = "login_user_key"
    # 防重提交 redis key
    REPEAT_SUBMIT_KEY = "repeat_submit:"
    # 限流 redis key
    RATE_LIMIT_KEY = "rate_limit:"
    # 接口缓存redis key
    API_CACHE_KEY = "api_cache:"


class TokenConstants:
    """
    令牌常量
    """
    # 令牌
    AUTHENTICATION = "token"
    # 令牌前缀
    TOKEN_PREFIX = "Bearer "
    # 令牌秘钥
    SECRET = "PFyUPzwx236GzxqPjaZ5Cb4BDHZAjDehPvdMWNFGHv87SPWx"


class EncryptConstants:
    """
    加密常量
    """
    # 加密密钥
    ENCRYPT_SECRET = "PFyUPzwx236GzxqP"

class DBConstants:
    STATUS_OK = 1
    STATUS_ERROR = 0


class TimeUnit:
    SECONDS = 1
    MINUTES = 60
    HOURS = 3600
    DAYS = 86400
